ChatbotMessageManager

class ChatbotMessageManager(addCurrentBranchLog: (List<ChatMessage>, ChatBranch) -> Unit, addCurrentBranchLogWithDate: (List<ChatMessage>, ChatBranch, Date?) -> Unit)

Manages the flow of messages (sending and generating bot replies) and the logic for different activities in the chatbot.

This class is responsible for maintaining the list of all messages, handling different branches (like Smart Goal, Thought Record, etc.), and simulating bot responses based on the user's input.

Parameters

addCurrentBranchLog

A function that adds the current branch log to the main log list.

addCurrentBranchLogWithDate

A function that adds the current branch log with a date to the main log list.

Constructors

Link copied to clipboard
constructor(addCurrentBranchLog: (List<ChatMessage>, ChatBranch) -> Unit, addCurrentBranchLogWithDate: (List<ChatMessage>, ChatBranch, Date?) -> Unit)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun addMessage(message: ChatMessage)

Adds a new message to the total message list by taking a ChatMessage object.

Link copied to clipboard
fun getBranch(userMessage: String)

Updates the current branch/activity based on the user's input message.

Link copied to clipboard

Returns a list of all available branches for the chatbot.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun sendCompletionDate(selectedDate: Date?)

Sends the selected completion date to the chatbot manager.

Link copied to clipboard
suspend fun simulateBotResponse(userMessage: String)

Simulates the bot's response to the user's input. This introduces a small delay before the bot replies to make the interaction feel more natural.